<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="<%=basePath%>css/login_type.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="<%=basePath%>easyui/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/md5.js"></script>
		<link type="text/css" rel="stylesheet" href="<%=basePath %>jBox/Skins/Red/jbox.css"/>

		<script type="text/javascript" src="<%=basePath %>jBox/jquery.jBox-2.3.min.js"></script>
		<script type="text/javascript" src="<%=basePath %>jBox/i18n/jquery.jBox-zh-CN.js"></script>
		<title>乐共享后台管理系统</title>
		<script type="text/javascript">

			var path = "<%=path%>";
			function login() {
				var username = $('#username').attr('value');
				var password = $('#password').attr('value');
				var vaildcode = $('#vaildcode').attr('value');

				if(username == "" || username == null || username == undefined){
					$.jBox.info("帐号不能为空！");
					return;
				}
				
				if(password == "" || password == null || password == undefined){
					$.jBox.info("密码不能为空！");
					return;
				}
				
				if(vaildcode == "" || vaildcode == null || vaildcode == undefined){
					$.jBox.info("验证码不能为空！");
					return;
				}
				
				$('#passwordMD5').attr('value',hex_md5(password));
				
				//$.ajax()
				$('#form').submit();
			}
			
			function refresh(img) {
				img.src = path + "/validateCode.do?t="+new Date().getTime();
			}
			
			function keyDown(event){
				if(event.keyCode == 13)
				{
					login();
				}
			}
		</script>

	</head>

	<body>
		<div id="box">
			<form id="form" action="user/login.do" method="post">
				<table border="0" align="center" cellpadding="0"
					cellspacing="0" class="log_table">
					<tr>
						<td class="log1">
							&nbsp;
						</td>
						<td class="log2">
							&nbsp;
						</td>
					</tr>
					<tr>
						<td class="log3">
							&nbsp;
						</td>
						<td class="log4">
							&nbsp;
						</td>
					</tr>
					<tr>
						<td colspan="2" valign="top" class="log5">
							<ul>
								<li>
									<span class="r1">用户名：</span>
									<label>
										<input id="username" name="username" type="text"/>
									</label>
								</li>
								<li>
									<span class="r1">密&nbsp;&nbsp;码：</span>
									<label>
										<input id="password" name="password" type="password"/>
										<input id="passwordMD5" name="passwordMD5" type="hidden"/>
									</label>
								</li>
								<li>
									<span class="r1">验证码：</span>
									<label>
										<input id="vaildcode" name="vaildcode" type="text" onKeyDown="keyDown(event)" class="r2">
										<span><img src="<%=basePath%>/validateCode.do"
												onclick="refresh(this)" />
										</span>
									</label>
								</li>
								<li class="r3">
									<input type="button" id="btnLogin" class="logbut"
										onclick="login()" />
								</li>
							</ul>
						</td>
					</tr>
				</table>
			</form>

		</div>
	</body>
</html>
